package com.atguigu.gmallre.mock.log;


import com.atguigu.gmallre.mock.config.AppConfig;
import com.atguigu.gmallre.mock.log.enums.DisplayType;
import com.atguigu.gmallre.mock.log.enums.ItemType;
import com.atguigu.gmallre.mock.log.enums.PageId;
import com.atguigu.mock.util.RandomNum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class AppPage {


     PageId last_page_id;

     PageId page_id;

     ItemType item_type;

     String item;

     Integer from_pos_id;

     Integer from_pos_seq;

     @Builder.Default
     Integer during_time= RandomNum.getRandInt(5000,15000);

     String refer_id;

     String extend1;

     String extend2;


    public static class AppPageBuilder {
//         public  AppPage build(){
//              AppPage appPage = new AppPage();
//              if( last_page_id==null){
//
//                     appPage.setRefer_id(refer_id);
//              }
//             appPage
//              appPage.setRefer_id(refer_id);
//              appPage.setItem_type(item_type);
//              appPage.setItem(item);
//              appPage.setExtend1(extend1);
//              appPage.setExtend2(extend2);
//
//
//             return  appPage;
//         }

        public  AppPage buildFinal() {

           if(last_page_id==null){
               refer_id=AppConfig.referRandomBuilder.getNum()+"";
           }

           return build();
        }

    }




     public static void main(String[] args) {
          AppPage appPage = AppPage.builder().page_id(PageId.home).build();
          System.out.println(appPage.toString());
     }



}
